/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demonstration.tab;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author Nastya
 */
public class RatingRenderer extends JLabel implements TableCellRenderer {

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if (!(value instanceof Double)) {
            setText("");
            return this;
        }
        Double doubleValue = (Double) value;
        String formattedValue = String.format("%0$f", doubleValue);
        setText(formattedValue);
        return this;
    }
}
